<div id="div_wincombo"  style="z-index:400;" align="center">
<?php

  $total_columnas = count($columnasWincombo);
  $total_datos    = count($datosWincombo);//$datosWincombo->getRecordCount();
  
?>
<?php use_helper('Javascript','I18N'); ?>

<table width="500" class="con_borde" cellspacing="5" cellpadding="0" border="0">
 <!--   <tr>
        <td align="right">
        <a href="#" onclick="cerrarWincombo();">
        <?php echo image_tag(sfConfig::get('sf_admin_web_dir').'/images/cerrar.png',array ('alt'=>'Cerrar','title'=>'Cerrar')) ?>
        </a>
        </td>
    </tr>
    -->
    <tr>
        <td class="titulo">Ventana de Selecci&oacute;n</td>
    </tr>
    <tr>
        <td height="20px"></td>
    </tr>
    <tr>
    <td>
    <form id="form_wincombo" onsubmit="return false;">
    <table>
    <tr>
    <?php for ($w=0; $w<count($filtros); $w++): ?>
    <?php $valor_filtro = isset($patron[$filtros[$w]])?$patron[$filtros[$w]]:''; ?>
        <td><?php echo $label_filtro[$w] ?><input type="text" name="patron[<?php echo $filtros[$w] ?>]" value="<?php echo $valor_filtro ?>"></td>
        <?php 
        if(isset($patron[$filtros[$w]]))
        $get_params .= "patron[$filtros[$w]]=".$patron[$filtros[$w]]."&";
        ?>
    <?php endfor; ?>
        <td>
<?php echo submit_to_remote(__('Buscar'), 'buscar', array (
  'url' => 'wincombo/index',
  'update' => 'div_wincombo',
  'get_params' => $get_params, 
  'script' => 'true', 
  'class' => 'sf_admin_action_delete',
)) ?>
        
        </td>
    </tr>
    </table>
    </form>
    </td>
    </tr>
    <tr>
        <td align="center">
        <table width="100%" cellpadding="0" cellspacing="1" border="0">
            <tr>
                <?php foreach ($columnasWincombo as $key => $valor):  ?>
                <td class="titulo_columna" width="<?php echo $valor ?>"><?php echo $key ?></td>
                <?php endforeach; ?>
            </tr>
    
            <?php
            
            $indice = 1;
            if ($pager->getPage()>1)
                $indice = (($pager->getPage() - 1) * $pager->getMaxPerPage())+1;
        
            $control_td = 1;
            foreach ($datosWincombo as $objeto)
            {
                $clase_td = "lista2";
                if ($control_td % 2 == 1)
                    $clase_td = "lista1";
                
                $control_td++;
            ?>

            <?php

                $mostrar = "'".$objeto->getByName($camposLlave, BasePeer::TYPE_FIELDNAME)."',";
                $mostrar .= "'".$objeto->__toString()."',";
                
                for($i=0; $i<count($camposSelect); $i++)
                {
                    if(isset($camposSelect[$i]))
                    $mostrar .= "'".$objeto->$camposSelect[$i]()."',";
                }
            ?>
            <tr style="cursor: pointer;" onmouseover="this.style.color='#C33'"  onmouseout="this.style.color='#333'"  onclick="descargarDatos([<?php echo $mostrar; ?>]);">
                <td class="<?php echo $clase_td; ?>" align="right"><?php echo "$indice."; ?></td>
                
                <?php foreach($columnasTabla as $i): ?>
                <?php  ?>
                <td class="<?php echo $clase_td; ?>" align="left"><?php 
                
                $valor = "";
                try
                {
                     $valor =  $objeto->getByName($i, BasePeer::TYPE_FIELDNAME);
                }catch(Exception $e)
                {
                     $metodo = $i;
                     if(is_callable(array($objeto, $metodo)))
                     {
                        $valor = $objeto->$metodo();          
                     }else
                     {
                     	$valor = "Metodo no implementado [".$metodo."]";                    	
                     }
                }
                 
                echo $valor;
                
                ?></td>
                <?php endforeach; ?>
            </tr>
            
            <?php
                $indice++;
            } // Fin foreach
            ?>
            
            <tr>
                <td height="20px"></td>
            </tr>  
        </table>

        

        <?php 
        //echo "aqui va: ".Herramienta::prueba();
        ?>
        
        <div id="div_pager">
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td>
                <table>
                    <?php if ($pager->haveToPaginate()): ?>
                    <tr>
                        <td>
                        <?php echo link_to_remote(image_tag(sfConfig::get('sf_admin_web_dir').'/images/first.png'),
                            array(
                            'update'   => array('success' => 'div_wincombo', 'failure' => 'error'),
                            'url'      => 'wincombo/index',
                            'get_params' => $get_params.'page=1',
                            'method'   => 'GET',
                            'script' => 'true',
                        ), array('align' => 'absmiddle', 'alt' => __('Primera'), 'title' => __('Primera')));
                        ?>
                        </td>
                        
                        <td>
                        <?php echo link_to_remote(image_tag(sfConfig::get('sf_admin_web_dir').'/images/previous.png'),
                            array(
                            'update'   => array('success' => 'div_wincombo', 'failure' => 'error'),
                            'url'      => 'wincombo/index',
                            'get_params' => $get_params.'page='.$pager->getPreviousPage(),
                            'method'   => 'GET',
                            'script' => 'true',
                        ), array('align' => 'absmiddle', 'alt' => __('Anterior'), 'title' => __('Anterior')));
                        ?>
                        </td>
    
                        <?php 
                        foreach ($pager->getLinks(10) as $page):
                            $class_css = "";
                            if ($pager->getPage() == $page) 
                                $class_css = "pagina_actual";
                        ?>
                        <td>
                        <?php
                            echo link_to_remote($page,
                            array(
                            'update'   => array('success' => 'div_wincombo', 'failure' => 'error'),
                            'url'      => 'wincombo/index',
                            'get_params' => $get_params.'page='.$page,
                            'method'   => 'GET',
                            'script' => 'true',
                        ), array('class' => "$class_css", 'align' => 'absmiddle', 'alt' => __("$page"), 'title' => __("$page")));
                        ?>
                        </td>
                        <?php endforeach; ?>
    
                        <td>
                        <?php echo link_to_remote(image_tag(sfConfig::get('sf_admin_web_dir').'/images/next.png'),
                            array(
                            'update'   => array('success' => 'div_wincombo', 'failure' => 'error'),
                            'url'      => 'wincombo/index',
                            'get_params' => $get_params.'page='.$pager->getNextPage(),
                            'method'   => 'GET',
                            'script' => 'true',
                        ), array('align' => 'absmiddle', 'alt' => __('Siguiente'), 'title' => __('Siguiente')));
                        ?>
                        </td>
                        
                        <td>
                        <?php echo link_to_remote(image_tag(sfConfig::get('sf_admin_web_dir').'/images/last.png'),
                            array(
                            'update'   => array('success' => 'div_wincombo', 'failure' => 'error'),
                            'url'      => 'wincombo/index',
                            'get_params' => $get_params.'page='.$pager->getLastPage(), 
                            'method'   => 'GET',
                            'script' => 'true',
                        ), array('align' => 'absmiddle', 'alt' => __('&Uacute;ltima'), 'title' => __('&Uacute;ltima')));
                        ?>
                        </td>
                    </tr>
                    <?php endif; // if ($pager->haveToPaginate())?>
                </table>
                </td>
            </tr>      
            <tr>
                <td>
                <table width="100%">
                    <tr>
                        <td align="center">
                        <?php echo "Total Registros: ".$pager->getNbResults(); ?>
                        </td>
                    </tr>
                </table>
                </td>
            </tr>
            
        </table>
        </div>  <!-- Fin div_pager -->
        </td>
    </tr>
</table>
</div>  <!-- Fin div_wincombo -->

